<%@page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<%@include file="/includes/taglibs.jsp"%>
<%@page import="com.feib.soeasy.util.UserUtil"%>

<script type="text/javascript">
<!--    
	$(document).ready(function() {

		$("[id^='doDisabledBtn']").click(function() {
		    doDisabledAction();
		});

		$("#checkAll").click(function() {
		    doCheckAll();
		});
		$("#unCheckAll").click(function() {
		    undoCheckAll();
		});
	});
    
//-->
</script>

<c:choose>
    <c:when test="${null != actionBean.queryResult && not empty actionBean.queryResult.paginatedList}">
	    <stripes:form name="confirmHiddenFrom" id="confirmHiddenFrom" beanclass="com.feib.soeasy.action.Soez9012ActionBean" 
	        method="post" onsubmit="javascript: return false;">    
	        	         
	        <table id="listTable">
	            <thead>
	                <tr>
	                	<th>&nbsp;</th>
						<%if ( UserUtil.isBankGroup()){ %>
						<th>業者名稱</th>
						<%} %>
	                    <th>帳號</th>
	                    <th>SESSION ID</th>
	                    <th>最近一次登入時間</th>
	                    <th>登入位址</th>
	                    <th>最近異動時間</th>
	                </tr>
	            </thead>
	            <tbody>
	                <c:forEach items="${actionBean.queryResult.paginatedList}" var="viewObj" varStatus="rowstat">
	                <tr>
	                	<td><input name="checkUserLogout[${rowstat.index}].userLoginConPk" type="checkbox" id="checkUserLogout[${rowstat.index}].userLoginConPk" value="<c:out value='${viewObj.userLoginConPk}'/>" class="chk"/></td>
	                    <%if ( UserUtil.isBankGroup()){ %>
						<td><c:out value="${viewObj.user.group.groupName}" /></td>
						<%} %>
	                    <td><c:out value="${viewObj.user.userId}"/></td>
	                    <td><c:out value="${viewObj.sessionId}"/></td>
	                    <td><fmt:formatDate value="${viewObj.loginTime}" pattern="yyyy/MM/dd HH:mm:ss" /></td>
	                    <td><c:out value="${viewObj.loginLocale}"/></td>           
	                    <td><fmt:formatDate value="${viewObj.activityTime}" pattern="yyyy/MM/dd HH:mm:ss" /></td> 
	                </tr>
	                </c:forEach>
	            </tbody>
	        </table>
	        <table width="100%">
	            <tr align="center">
	                <td>
						<input type="button"  id="checkAll" name="checkAll"  value="全選">
	                    <input type="button"  id="unCheckAll" name="unCheckAll" value="全不選">
	                    <input type="button" id="doDisabledBtn" name="doDisabledBtn" value="登出">
	                </td>
	            </tr>
	        </table>
	        <input type="hidden" id="method" name="doAjaxUserInfoDisabledAction"/>	        
	    </stripes:form>        
    </c:when>    
    <c:otherwise>
        <div id="queryNothingBlockDiv" style="display: none;">
        	查無資料
        </div>  
		<script type="text/javascript">
		<!--
		$(document).ready(function() {
			$( "#queryNothingBlockDiv" ).dialog( "destroy" );
			$( "#queryNothingBlockDiv" ).dialog({  title:'<%=UserUtil.getCurrentMenuItemName() %>查詢' ,width: 300, resizable: false, modal: true, buttons : {
				Ok : function() {
					$(this).dialog("close");
				}
			}  });
		});
		//-->
		</script>    
    </c:otherwise>
</c:choose>